﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddProductLayoutRole.aspx.cs" Inherits="ZX.WebApp.Crm.MeetingArrange.AddProductLayoutRole" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">
    textarea,input
    {
        width:200px; 
    }

</style>
    <title></title>
        <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
      <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <!-- OPTIONAL: Connection Manager (enables XHR for DataSource) -->
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <!-- OPTIONAL: Get Utility (enables dynamic script nodes for DataSource) -->
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <!-- OPTIONAL: Drag Drop (enables resizeable or reorderable columns) -->
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <!-- OPTIONAL: Calendar (enables calendar editors) -->
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/calendar/calendar-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/resize/resize-min.js"></script>

    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
        <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <script src="../../Scripts/Appjs/jquery.CheckData.js" type="text/javascript"></script>
    <script src="../../Scripts/common.js" type="text/javascript"></script>
</head>
<body class="yui-skin-sam">
    <form id="form1" runat="server">
    <div>
        <table style="width:100%  cellpadding='0' cellspacing='0' border='0.5px' line-height:'30px' " id="tbProductLayoutrole" >
            <tr><td>产品规划:</td><td>  <input id="txtProductLayout" readonly="readonly" style="background-color: #CCCCCC" value='<%=ProductName %>' /></td></tr>
            <tr><td>产品角色:</td><td><select id='ProductRoleID' name='ProductRoleID'></select></td></tr>
            <tr><td>用&nbsp&nbsp;户</td><td><input type="hidden" id="UserId" name="UserId" class="yui-dept"/><input id="txtUserId"  type="text"  readonly="readonly" value=""  class="yui-text" dtype="Z" /><button id="btnAddUser" name="V" type="button" value="" onclick="ChooseUser();">选择</button></td></tr>
            <tr><td>备&nbsp&nbsp;注</td><td><textarea id="Explain" cols="10" rows="3"></textarea> </td></tr>
        </table>
    </div>
      <div id="dialog1" class="yui-pe-content">
        <div class="hd">
            选择用户</div>
        <div class="bd">
            <iframe id="EditUIWindow1" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>

    </form>
     <form id="form2" >
        <textarea style="display: none" id="jsonDataContent" rows="2" cols="2" name="jsonDataContent"></textarea>
           <textarea style="display: none" id="userDataContent" rows="2" cols="2" name="userDataContent"></textarea>
    </form>
</body>
<script type="text/javascript">
        <asp:Literal ID="EditTemplate" runat="server"></asp:Literal>
        ///加载产品角色
        var handleSuccess=function(o){
            $("#ProductRoleID").comBind("["+o.responseText+"]","PhraseID","PhraseText");
             
        }
        
        var handleFailure = function (o) {
            alert(o.responseText);
        }
         var callback=
        {
            success: handleSuccess,
            failure: handleFailure,
            argument: { foo: "foo", bar: "bar" }
        };
       var url = "../Common/DataProcessin.aspx?entity=ProductRole&action=get&r="+Math.random()+"";
           var request = YAHOO.util.Connect.asyncRequest('Post', url, callback);
    


      //创建窗口
        YAHOO.namespace("example.container");
       (function initWindow()
       {
           // Define various event handlers for Dialog
           var handleSubmit = function () {
                var editwindow = document.getElementById("EditUIWindow1");
                if (editwindow) {
                    editwindow.contentWindow.ChooseInfo();
                }
                this.cancel();
              };

          var handleCancel = function () {
                this.cancel();
            };
          var handleSubmit1 = function () {
                    var editwindow = document.getElementById("EditUIWindow2");
                    if (editwindow) {
                        editwindow.contentWindow.ChooseInfo();
                    }
                    this.cancel();
                //YAHOO.example.container.dialog2.hide();
            }

         // Remove progressively enhanced content class, just before creating the module
          YAHOO.util.Dom.removeClass("dialog1", "yui-pe-content");

    /*
    数据编辑
    */
      YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
							    { width: 300,
							        height: 300,
							        fixedcenter: false,
							        visible: false,
							        draggable: true,
							        close: true,
							        constraintoviewport: false,
							        buttons: [{ text: "保存", handler: handleSubmit, isDefault: true },
								          { text: "取消", handler: handleCancel}]
							    });

      
       YAHOO.example.container.dialog1.render();
    

       })();
       var getSelected=function(v, t)
       {
            //alert(v);
        if (v != "") {
           $("#UserId").val(v);
        }
        $("#txtUserId").val(t);
       }
       //新增产品规划角色
       function ChooseUser()
       { 
          var getUrl="http://" + this.location.host + "/EditWidows/ChooseList.aspx",condition='1=1';
          parent.document.getElementById("EditUIWindow2").src = getUrl+"?r=" + Math.random() + "&kid=UserID&kname=Name&ShowCheckBox=true&entity=V_UserEmp&condition=" + decodeURI(condition);
          parent.ShowDialog1(getSelected);
       }
        //为控件赋值
         function setValue()
        {
            instance[0].ID="<%=Guid.NewGuid() %>";
            instance[0].ProductLayoutId=getPar1("LayoutId");
            $("#tbProductLayoutrole").SetFormValueToObject(instance[0]);
        }
        //保存产品规划角色
         var callback1 = function (o) {
            if (o.responseText != "0") {
   
            }
        }
        function Save(){
          setValue();
          var json =$.toJSON(instance[0]).replace(/'/g,"[B]");
          $("#userDataContent").val($("#UserId").val());
          $("#jsonDataContent").val(json);
          var formObject = document.getElementById('form2');
          YAHOO.util.Connect.setForm(formObject);

        
           var url = "../Common/DataProcessin.aspx?entity=crmproductlayoutrole&action=save&r="+Math.random()+"";
          var request = YAHOO.util.Connect.asyncRequest('Post', url, callback1);
        }
</script>
</html>
